package com.study.mxj.cpprop;

import com.study.common.cpprop.entity.CarOrder;
import com.study.common.cpprop.entity.PayOrder;
import com.study.common.cpprop.entity.User;
import com.study.common.cpprop.util.CopyPropertiesUtil;

import java.time.LocalDateTime;

/**
 * @author mengxj
 */
public class CpPropTest {

    public static void main(String[] args) {
        CarOrder target = new CarOrder();
        target.setId("target-id");
        target.setName("target-name");
        target.setCreateTime("2022-12-12 12:12:12");
        target.setOrderDate(LocalDateTime.now());
        System.out.println("=============== target ===================");
        System.out.println(target);
        User userObject = new User();
        CopyPropertiesUtil.copy(target, userObject);
        System.out.println("=============== userObject ===================");
        //只有id没赋值，因为类型不同
        System.out.println(userObject);
        PayOrder payObject = new PayOrder();
        CopyPropertiesUtil.copy(target, payObject);
        System.out.println("=============== payObject ===================");
        //只有id没赋值，因为PayOrder的id没有get/set方法
        System.out.println(payObject);
        CarOrder orderObject = new CarOrder();
        CopyPropertiesUtil.copy(target, orderObject);
        System.out.println("=============== orderObject ===================");
        System.out.println(orderObject);
    }
}
